
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

#define N 6000
#define PUNTS 1000

int main(int argc, char *argv[])
{
	unsigned int i, j, k, r, n;
	double d;
	double saved_cos[PUNTS];
	double saved_sin[PUNTS];
	double buffer_x_y[PUNTS*2];

	if (argc == 1) n = N; else n = atoi(argv[1]);

	for (j=0, d=0; j<PUNTS; j++)
	{
		saved_cos[j] = cos(d);
		saved_sin[j] = sin(d);
		d += 2 * M_PI / PUNTS;
	}

	srand(0);
	for (i=0; i<n; i++)
	{
		r = rand();
		for (j=0, k=0; j<PUNTS; j++)
		{
			buffer_x_y[k] = r * saved_cos[j];
			buffer_x_y[k+1] = r * saved_sin[j];
			k += 2;
		}
		fwrite(buffer_x_y, sizeof(d), PUNTS*2, stdout);
	}
	return 0;
}

/*int main(int argc, char *argv[])
{
	unsigned int i, r, j, n;
	double d, x, y;

	if (argc == 1) n = N; else n = atoi(argv[1]);

	srand(0);
	for (i=0; i<n; i++)
	{
		r = rand();
		for (j=0, d=0; j<PUNTS; j++)
		{
			x = r*cos(d); y = r*sin(d);
			fwrite(&x, sizeof(x), 1, stdout);
			fwrite(&y, sizeof(y), 1, stdout);
			d += 2*M_PI/PUNTS;
		}
	}
	return 0;
}*/
